/*
 * p4462.cpp
 *
 *  Created on: 2013-10-24
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int N, K;
int r[10], c[10], R[10];
bool cover[51][51];
int ans;
int bitcount(int x)
{
	return x == 0 ? 0 : bitcount(x / 2) + (x & 1);
}

int mhd(int x1, int y1, int x2, int y2)
{
	return abs(x1 - x2) + abs(y1 - y2);
}
void Cov(int x, int y, int R)
{
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			if (mhd(x, y, i, j) <= R)
				cover[i][j] = true;
}
bool check(int s)
{
	memset(cover, 0, sizeof(cover));
	for (int i = 0; i < K; i++)
	{
		cover[r[i]][c[i]] = 1;
		if (s & (1 << i))
			Cov(r[i], c[i], R[i]);
	}
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			if (!cover[i][j])
				return false;
	return true;
}
int main()
{
	while (scanf("%d", &N) && N != 0)
	{
		scanf("%d", &K);
		for (int i = 0; i < K; i++)
			scanf("%d%d", &r[i], &c[i]);
		for (int i = 0; i < K; i++)
			scanf("%d", &R[i]);
		int S = (1 << K) - 1;
		ans = 11;
		for (int i = 0; i <= S; i++)
		{
			if (check(i))
				ans = min(ans, bitcount(i));
		}
		if (ans == 11)
			puts("-1");
		else
			printf("%d\n", ans);
	}
	return 0;
}
